import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


public class NeighbouringNumbers {
	public static void main(String[] args) {
	    int qty;	
        System.out.println("Enter array length:");
		Scanner i=new Scanner(System.in);
		qty=i.nextInt();
		System.out.println("Enter numbers to fill an array:");
	 	int [] arr=new int[qty];
	 	int min=0;
	 	for (int j=0; j<qty; j++)
	 	{
	 		arr[j]=i.nextInt();
	 		if (j==1)
	 		{
	 			min=Math.abs(arr[j]-arr[j-1]);
	 		}
	 		if ((j>1) && (Math.abs(arr[j]-arr[j-1])<min))
	 			min = Math.abs(arr[j]-arr[j-1]);
	 	}
	 	System.out.println("The smallest distance is: " + min);
	}

}
